{template 'web/_header'}
{template 'tabs'}

{if $operation == 'post'}
<div class="main">
    <form {ife 'verify.store' $item}action="" method="post"{/if} class="form-horizontal form" enctype="multipart/form-data">
        <input type="hidden" name="id" value="{$item['id']}" />
        <div class='panel panel-default'>
            <div class='panel-heading'>
                核销门店设置
            </div>
            <div class='panel-body'>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span> 门店名称</label>
                    <div class="col-sm-9 col-xs-12">
                        {ife 'verify.store' $item}
                        <input type="text" name="storename" class="form-control" value="{$item['storename']}" />
                        {else}
                        <div class='form-control-static'>{$item['storename']}</div>
                        {/if}
                    </div>
                </div>
               <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">门店地址</label>
                    <div class="col-sm-9 col-xs-12">
                            {ife 'verify.store' $item}
                        <input type="text" name="address" class="form-control" value="{$item['address']}" />
                               {else}
                        <div class='form-control-static'>{$item['address']}</div>
                        {/if}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">门店电话</label>
                    <div class="col-sm-9 col-xs-12">
                               {ife 'verify.store' $item}
                        <input type="text" name="tel" class="form-control" value="{$item['tel']}" />
                               {else}
                        <div class='form-control-static'>{$item['tel']}</div>
                        {/if}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">门店位置</label>
                    <div class="col-sm-9 col-xs-12">
                               {ife 'verify.store' $item}
                        {php echo tpl_form_field_coordinate('map',array('lng'=>$item['lng'],'lat'=>$item['lat']))}
                               {else}
                        <div class='form-control-static'>lng={$item['lng']},lat={$item['lat']}</div>
                        {/if}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">状态</label>
                    <div class="col-sm-9 col-xs-12">
                               {ife 'verify.store' $item}
                        <label class='radio-inline'>
                            <input type='radio' name='status' value=1' {if $item['status']==1}checked{/if} /> 启用
                        </label>
                        <label class='radio-inline'>
                            <input type='radio' name='status' value=0' {if $item['status']==0}checked{/if} /> 禁用
                        </label>
                               {else}
                        <div class='form-control-static'>{if $item['status']==1}启用{else}禁用{/if}</div>
                        {/if}
                    </div>
                </div>
                
                      <div class="form-group"></div>
            <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
                    <div class="col-sm-9 col-xs-12">
                           {ife 'verify.store' $item}
                            <input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1"  />
                            <input type="hidden" name="token" value="{$_W['token']}" />
                        {/if}
                       <input type="button" name="back" onclick='history.back()' {ifp 'verify.store.add|verify.store.edit'}style='margin-left:10px;'{/if} value="返回列表" class="btn btn-default" />
                    </div>
            </div>
                      
                      
                
            </div>
        </div>
       
    </form>
</div>
<script language='javascript'>
    $('form').submit(function(){
        if($(':input[name=storename]').isEmpty()){
            Tip.focus($(':input[name=storename]'),'请输入门店名称!');
            return false;
        }
        return true;
    })
    </script>
{elseif $operation == 'display'}
               <form action="" method="post" onsubmit="return formcheck(this)">
     <div class='panel panel-default'>
            <div class='panel-heading'>
                核销门店设置
            </div>
         <div class='panel-body'>

            <table class="table">
                <thead>
                    <tr>
                        <th>门店名称</th>
                        <th>门店地址</th>
                        <th>门店电话</th>
                        <th>核销员数量</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    {loop $list $row}
                    <tr>
                        <td>{$row['storename']}</td>
                        <td>{$row['address']}</td>
                           <td>{$row['tel']}</td>                            
                           <td>{$row['salercount']}</td>                            
                                 <td>
                                    {if $row['status']==1}
                                    <span class='label label-success'>启用</span>
                                    {else}
                                    <span class='label label-danger'>禁用</span>
                                    {/if}
                                </td>
                        <td>
                          {ifp 'verify.store.edit|verify.store.view'}<a class='btn btn-default' href="{php echo $this->createPluginWebUrl('verify/store', array('op' => 'post', 'id' => $row['id']))}"><i class='fa fa-edit'></i></a>{/if}
                          {ifp 'verify.store.delete'}<a class='btn btn-default'  href="{php echo $this->createPluginWebUrl('verify/store', array('op' => 'delete', 'id' => $row['id']))}" onclick="return confirm('确认删除此门店吗？');return false;"><i class='fa fa-remove'></i></a>{/if}</td>

                    </tr>
                    {/loop}
                 
                </tbody>
            </table>
  
         </div>
          {ifp 'verify.store.add'}
           <div class='panel-footer'>
                            <a class='btn btn-default' href="{php echo $this->createPluginWebUrl('verify/store', array('op' => 'post'))}"><i class="fa fa-plus"></i> 添加新门店</a>
         </div>
          {/if}
     </div>
       </form>
{/if}
{template 'web/_footer'}